home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / strdup.c < prev    next >
C/C++ Source or Header  |  1992-09-17  |  294b  |  21 lines

  1. /*
  2.  * strdup: return a duplicate of a string
  3.  * Written by Eric R. Smith and placed in the public domain.
  4.  */
  5.  
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #undef strdup
  9.  
  10. char *
  11. strdup(s)
  12.     const char *s;
  13. {
  14.     char *dup;
  15.  
  16.     dup = (char *) malloc(strlen(s)+1);
  17.     if (dup)
  18.         strcpy(dup, s);
  19.     return dup;
  20. }
  21.